﻿@model TenderSampleApp.Models.Profile.JuridicalUserProfileModel
@{
    ViewBag.Title = "CheckJuridicalUserProfile";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <script type="text/javascript">
        function doSearch() {
            var error = 0;
            $('#1td input:text').each(function () {
                var val1 = $(this).val();
                var id = $(this).attr('id');
                if ($('#' + id + '2').val() != val1) {
                    $('#' + id + '2').css('background-color', '#FFB9B9');
                    $(this).css('background-color', '#FFB9B9');
                    error++;
                }
                else {
                    $('#' + id + '2').css('background-color', '');
                    $(this).css('background-color', '');
                }

            });
            return error;
        }
        $(document).ready(function () {
            $('#btn').click(function () {
                var error = doSearch();
                if (error == 0)
                    return true;
                return false;
            });
            doSearch();
            $('input:text').keyup(function () {
                doSearch();
            });

        });
    </script>
}
<h2>
    Перевірка профайлів</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Виправте профайл щоб вони були ідентичні</legend>
        <table>
            <thead>
                <tr>
                    <th>
                        <b>Перший профайл</b>
                    </th>
                    <th>
                        <b>Другий профайл</b>
                    </th>
                </tr>
            </thead>
            <tr>
                <td id="1td">
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Code)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Code)
                        @Html.ValidationMessageFor(model => model.Code)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Name)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Name)
                        @Html.ValidationMessageFor(model => model.Name)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Phone)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Phone)
                        @Html.ValidationMessageFor(model => model.Phone)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Index)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Index)
                        @Html.ValidationMessageFor(model => model.Index)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Region)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Region)
                        @Html.ValidationMessageFor(model => model.Region)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.District)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.District)
                        @Html.ValidationMessageFor(model => model.District)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.City)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.City)
                        @Html.ValidationMessageFor(model => model.City)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Street)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Street)
                        @Html.ValidationMessageFor(model => model.Street)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Build)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Build)
                        @Html.ValidationMessageFor(model => model.Build)
                    </div>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Apartment)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Apartment)
                        @Html.ValidationMessageFor(model => model.Apartment)
                    </div>
                 
                </td>
                <td>
                   @using (TenderSampleApp.Models.Profile.JuridicalUserProfileModel upm = Session["userprofileconfirm"] as TenderSampleApp.Models.Profile.JuridicalUserProfileModel)
                    { 
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Code)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Code2", upm.Code)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Name)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Name2", upm.Name)
                        </div>
                        
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Phone)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Phone2", upm.Phone)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Index)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Index2", upm.Index)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Region)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Region2", upm.Region)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.District)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("District2", upm.District)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.City)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("City2", upm.City)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Street)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Street2", upm.Street)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Build)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Build2", upm.Build)
                        </div>
                        <div class="editor-label">
                            @Html.LabelFor(model => model.Apartment)
                        </div>
                        <div class="editor-field">
                            @Html.TextBox("Apartment2", upm.Apartment)
                        </div>
                    
                         
                    }
                
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" value="Cтворити профайл"  id="btn" />
        </p>
    </fieldset>
}
 
